﻿@inherits RenderViewPage
@using Umbraco.Cms.Web;
@using PBDesk.com.Extension.UmbHelper;
@using PBDesk.com.Extension.Articles;
@{
	string content = string.Empty;
	OArticle art = null;
	dynamic artOfDay = MyHelper.GetArticleOfTheDay(DynamicModel);
	if (artOfDay != null && artOfDay is OArticle)
	{
		art = artOfDay;
	}
	else
	{
		art = new OArticle(artOfDay);
		art.Author = new OAuthor(Umbraco.GetDynamicContentById(artOfDay.author));
		art.ContentProvider = new OContentProvider(Umbraco.GetDynamicContentById(artOfDay.contentProvider));
		PBDesk.com.Extension.WebHelper.CacheManager.SetArticleOfTheDay(art);
	}	
	if(artOfDay != null)
	{
		content = string.Format("<a href=\"{6}\">{5}:<br/><b>{0}</b></a><br/>{1}<br/>By:{2} [{3}]<br/>Tags: {4}", art.Title, art.Description, art.Author.Name, art.ContentProvider.Name, art.Tags, art.MetaTitle, "/Articles/ArticleOfTheDay");
		
	}
} 
@Html.Partial("Common/PreviewViewer", 
		new ViewDataDictionary { 
			{ "Title", "Article Of The Day!" }, 
			{"Link", "/Articles/ArticleOfTheDay"},
			{"SubTitle","Everyday a new article for developers to read."}, 
			{"SubTitle2","A Technical Article : Every Mon - Fri."}, 
			{"Image","http://cdn.PBDesk.com/images/icons/artofday128.png"}, 
			{"Content",content}  
		})